// GeneralJointRegular.h: interface for the GeneralJointRegular class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GENERALJOINTREGULAR_H__C1884F29_A679_469E_9AEF_40CAC578B950__INCLUDED_)
#define AFX_GENERALJOINTREGULAR_H__C1884F29_A679_469E_9AEF_40CAC578B950__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "FreeField.h"
#include "JointRegular.h"
#include "JointPortFormer.h"
class JointState;

class AFX_EXT_CLASS GeneralJointRegular : public JointRegular  
{
	DECLARE_DYNAMIC_CREATE(GeneralJointRegular)
	friend class JointRegularSet;
	friend class JointState;
	friend class FirstFixNextUnfix;
	friend class AllFix;
public:
	GeneralJointRegular();
	virtual ~GeneralJointRegular();

public:
	virtual BOOL Execute();
	void SetFirstFormer(JointSystem::JointPortFormer* pFormer){
		ASSERT(pFormer);
		m_pFirstFormer = pFormer;
	}

	void SetNextFormer(JointSystem::JointPortFormer* pFormer){
		ASSERT(pFormer);
		m_pNextFormer = pFormer;
	}

	void FirstJointTypeID(INT nID){
		m_nFirstJointStyleID = nID;
	}

	INT FirstJointTypeID(){
		return m_nFirstJointStyleID;
	}

	void NextJointTypeID(INT nID){
		m_nNextJointStyleID = nID;
	}

	INT NextJointTypeID(){
		return m_nNextJointStyleID;
	}

	const CString& PrevMatrixRegular() const {
		return m_strPrevMatrixRegular;
	}
	
	void PrevMatrixRegular(const CString& strRegular){
		this->m_strPrevMatrixRegular = strRegular;
	}

	const CString& NextMatrixRegular() const {
		return m_strNextMatrixRegular;
	}
	
	void NextMatrixRegular(const CString& strRegular){
		this->m_strNextMatrixRegular = strRegular;
	}

	GeneralJointRegular* Clone();

	void CaculateMatrix();

private:
	BOOL HasJointPort(JointSystem::JointPortFormer* pFormer);
	CString GetPressField(){
		return _T("pMax");
	}

	void GetFreeField(CString& strField, FreeField& field);
private:
	JointSystem::JointPortFormer* m_pFirstFormer;
	JointSystem::JointPortFormer* m_pNextFormer;
	INT m_nFirstJointStyleID;
	INT m_nNextJointStyleID;
	CString m_strPrevMatrixRegular;
	CString m_strNextMatrixRegular;

protected:
	void GenerateJointState();
};

#endif // !defined(AFX_GENERALJOINTREGULAR_H__C1884F29_A679_469E_9AEF_40CAC578B950__INCLUDED_)
